package com.xuecheng.message.sdk.config;

import com.xuecheng.message.sdk.mapper.MqMessageHistoryMapper;
import com.xuecheng.message.sdk.mapper.MqMessageMapper;
import com.xuecheng.message.sdk.service.IMqMessageHistoryService;
import com.xuecheng.message.sdk.service.IMqMessageService;
import com.xuecheng.message.sdk.service.impl.MqMessageHistoryServiceImpl;
import com.xuecheng.message.sdk.service.impl.MqMessageServiceImpl;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author 勾新杰
 * @version 1.0
 * @description: 手动配置service注册为bean、mapper扫描包、以及当前这个配置类采用spring.factories自动注入
 * @date 2023/9/26 21:01
 */
@Configuration
@MapperScan("com.xuecheng.message.sdk.mapper")
public class MqMessageSDKConfig {

    @Bean
    public IMqMessageService mqMessageService(MqMessageMapper mqMessageMapper, MqMessageHistoryMapper mqMessageHistoryMapper) {
        return new MqMessageServiceImpl(mqMessageMapper, mqMessageHistoryMapper);
    }

    @Bean
    public IMqMessageHistoryService mqMessageHistoryService(MqMessageHistoryMapper mqMessageHistoryMapper) {
        return new MqMessageHistoryServiceImpl(mqMessageHistoryMapper);
    }
}